home *** CD-ROM | disk | FTP | other *** search
- #! /bin/sh -e
-
- cmd="$1"
- runtime="$2"
-
- if which python >/dev/null 2>&1 && which pycentral >/dev/null 2>&1; then
- pycentral rtremove $runtime
- else
- flist=$(tempfile)
- for pcdir in /usr/share/pycentral/*; do
- pkg=$(basename $pcdir)
- find /usr/share/pycentral/$pkg -depth -mindepth 2 \
- \( -name '*.py' -printf 'p %P\n' -o -printf '%y %P\n' \) \
- > $flist 2>&1 || true
- if [ -s $flist ]; then
- d=/usr/lib/$runtime
- while read t n; do
- case "$t" in
- p) rm -f $d/$n $d/${n}[co];;
- d) rmdir --ignore-fail-on-non-empty $d/$n 2>/dev/null;;
- *) rm -f $d/$n
- esac
- done < $flist
- fi
- rm -f $flist
- done
-
- find /usr/share/pyshared -depth -mindepth 1 \
- \( -name '*.py' -printf 'p %P\n' -o -printf '%y %P\n' \) \
- > $flist 2>&1 || true
- if [ -s $flist ]; then
- for d in /usr/lib/$runtime/????-packages; do
- while read t n; do
- case "$t" in
- p) rm -f $d/$n $d/${n}[co];;
- d) rmdir --ignore-fail-on-non-empty $d/$n 2>/dev/null;;
- *) rm -f $d/$n
- esac
- done < $flist
- done
- fi
- rm -f $flist
- fi
-